/* eslint-disable import/no-anonymous-default-export */
import {list,add,del,allType,upload,upd} from '../services/circleNameApi';

export default {
    state: {
        data: []
    },
    effects: {
        async list(params) {
            const response = await list(params)
            if (response.code === 200) {
                this.saveData({
                    data: response.data,

                })
            }
        },
        async add(params) {
            await add(params)
        },
        async upd(params) {
            await upd(params)
        },
        async del(params) {
            await del(params)
        },
        async upload(params) {
            const response = await upload(params)
            return response
        },
        async allType() {
            const response = await allType();
            return response
        },

    },
    reducers: {
        saveData(state, paylode) {
            return {
                ...state,
                ...paylode
            }
        },

    }
}